<view>
    <view class="order_header">
        <view bindtap="switchNav" data-current="0" class="tab {{currentTab==0?'active':''}}">
            <view>全部</view>
        </view>
        <view bindtap="switchNav" data-current="1" class="tab {{currentTab==1?'active':''}}">
            <view>待付款</view>
        </view>
        <view bindtap="switchNav" data-current="2" class="tab {{currentTab==2?'active':''}}">
            <view>已完成</view>
        </view>
    </view>
    <swiper class="tab-content" current="{{currentTab}}" duration="300" bindchange="switchTab" style="height:{{winHeight}}rpx">
        <!-- 全部订单 -->
        <swiper-item>
            <scroll-view scroll-y="true" class="scoll-h" bindscrolltolower="lower" data-status="100"  data-list="allList">
                <block wx:for="{{allList.list}}" wx:key="*this">
                    <view class="order">
                        <view class="order_code">订单编号:{{item.orderCode}}</view>
                        <navigator class="navigator" url="/pages/detail/detail?code={{item.orderCode}}" hover-class="none">
                            <scroll-view class="img_container" scroll-x scroll-top="0" scroll-left="0" style="width:80%">
                                <view class="img_view" wx:for="{{item.orderGoods}}" wx:for-item="goodList" wx:key="*this">
                                    <image wx:if="{{goodList.imagePath}}" src="{{goodList.imagePath}}"></image>
                                    <image wx:else src="{{imageUrl}}/xiaomai.jpg"></image>
                                    <label wx:if="{{goodList.num>1}}">x{{goodList.num}}</label>
                                </view>
                            </scroll-view>
                            <view class="total_num">共{{item.num}}件</view>
                        </navigator>
                        <view class="order_footer">
                            <view class="left">
                                <view>总价:￥{{util.formatNum(item.originalPrice)}}</view>
                                <view class="red">
                                    <text wx:if="{{item.status==0}}">待付</text>
                                    <text wx:if="{{item.status==2}}">实付</text>
                                    <text wx:if="{{item.status==6}}">应付</text>
                                    ￥{{util.formatNum(item.price)}}
                                </view>
                            </view>
                            <view class="right">
                                <view class="status" wx:if="{{item.status==2}}">已完成</view>
                                <navigator wx:elif="{{item.status==0}}" class="pre_pay" url="/pages/pay/pay?code={{item.orderCode}}" hover-class="navigator-hover">待付款</navigator>
                                <view class="status" wx:if="{{item.status==6}}">已取消</view>
                            </view>
                        </view>
                    </view>
                </block>
                <view class="loadingText" wx:if="{{allList.list.length>0}}">
                        <image wx:if="{{!allList.isLast}}" class="loading" src="../../image/loading.png"></image>
                        <view class="text">{{allList.isLast?"订单加载完毕":"加载中..."}}</view>
                </view>
                <image class='empty_img' wx:else src="{{imageUrl}}/empty_order.png"></image>
            </scroll-view>
        </swiper-item>
        <!-- 待付款订单 -->
        <swiper-item>
            <scroll-view scroll-y="true" class="scoll-h" bindscrolltolower="lower" data-status="0" data-list="unpayList">
                <block wx:for="{{unpayList.list}}" wx:key="*this">
                    <view class="order">
                        <view class="order_code">订单编号:{{item.orderCode}}</view>
                        <navigator class="navigator" url="/pages/detail/detail?code={{item.orderCode}}" hover-class="none">
                            <scroll-view class="img_container" scroll-x scroll-top="0" scroll-left="0" style="width:80%">
                                <view class="img_view" wx:for="{{item.orderGoods}}" wx:for-item="goodList" wx:key="*this">
                                    <image wx:if="{{goodList.imagePath}}" src="{{goodList.imagePath}}"></image>
                                    <image wx:else src="{{imageUrl}}/xiaomai.jpg"></image>
                                    <label wx:if="{{goodList.num>1}}">x{{goodList.num}}</label>
                                </view>
                            </scroll-view>
                            <view class="total_num">共{{item.num}}件</view>
                        </navigator>
                        <view class="order_footer">
                            <view class="left">
                                <view>总价:￥{{util.formatNum(item.originalPrice)}}</view>
                                <view class="red">
                                    <text wx:if="{{item.status==0}}">待付</text>
                                    ￥{{util.formatNum(item.price)}}
                                </view>
                            </view>
                            <view class="right">
                                <navigator  class="pre_pay" url="/pages/pay/pay?code={{item.orderCode}}" hover-class="navigator-hover">待付款</navigator>
                            </view>
                        </view>
                    </view>
                </block>
                <view class="loadingText" wx:if="{{unpayList.list.length>0}}">
                        <image wx:if="{{!unpayList.isLast}}" class="loading" src="../../image/loading.png"></image>
                        <view class="text">{{unpayList.isLast?"订单加载完毕":"加载中..."}}</view>
                </view>
                <image class='empty_img' wx:else src="{{imageUrl}}/empty_order.png"></image>
            </scroll-view>
        </swiper-item>
        <!-- 已完成订单 -->
        <swiper-item>
            <scroll-view scroll-y="true" class="scoll-h" bindscrolltolower="lower" data-status="2" data-list="succList">
                <block wx:for="{{succList.list}}" wx:key="*this">
                    <view class="order">
                        <view class="order_code">订单编号:{{item.orderCode}}</view>
                        <navigator class="navigator" url="/pages/detail/detail?code={{item.orderCode}}" hover-class="none">
                            <scroll-view class="img_container" scroll-x scroll-top="0" scroll-left="0" style="width:80%">
                                <view class="img_view" wx:for="{{item.orderGoods}}" wx:for-item="goodList" wx:key="*this">
                                    <image wx:if="{{goodList.imagePath}}" src="{{goodList.imagePath}}"></image>
                                    <image wx:else src="{{imageUrl}}/xiaomai.jpg"></image>
                                    <label wx:if="{{goodList.num>1}}">x{{goodList.num}}</label>
                                </view>
                            </scroll-view>
                            <view class="total_num">共{{item.num}}件</view>
                        </navigator>
                        <view class="order_footer">
                            <view class="left">
                                <view>总价:￥{{util.formatNum(item.originalPrice)}}</view>
                                <view class="red">
                                    <text wx:if="{{item.status==2}}">实付</text>
                                    ￥{{util.formatNum(item.price)}}
                                </view>
                            </view>
                            <view class="right">
                                <view class="status" wx:if="{{item.status==2}}">已完成</view>
                            </view>
                        </view>
                    </view>
                </block>
                <view class="loadingText" wx:if="{{succList.list.length>0}}">
                        <image wx:if="{{!succList.isLast}}" class="loading" src="../../image/loading.png"></image>
                        <view class="text">{{unpayList.isLast?"订单加载完毕":"加载中..."}}</view>
                </view>
                <image class='empty_img' wx:else src="{{imageUrl}}/empty_order.png"></image>
            </scroll-view>
        </swiper-item>
    </swiper>
</view>

<wxs module="util"> 
        var formatNum=function(n){ 
            return Number(n)
    } 
    module.exports = { 
        formatNum:formatNum 
    }
</wxs>